﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.DAO;
using ERP_RORZE_DLL.Product.database;
using ERP_RORZE_PERMISSION.Base;

namespace ERP_RORZE_PRODUCT.Product.BasicList
{
    public partial class frm_SectionEdit : DevExpress.XtraEditors.XtraForm
    {
        public event EventHandler Reload;
        ClsBasicListDAO clsBasiclistDAO = new ClsBasicListDAO();
        Section b = new Section();
        public string SectionID;
        public string SectionName;
        private LogUtils log;

        public frm_SectionEdit()
        {
            InitializeComponent();
            log = new LogUtils();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            b.SectionID = txtSectionID.Text;
            b.SectionName = txtSectionName.Text;
            clsBasiclistDAO.UpdateSection(b);

            //write Log
            log.Table = LogConstant.Table.Product.Section;
            log.Task = LogConstant.Task.Update;
            log.Description = b.SectionID;
            log.WriteLog();

            Reload(sender, e);
        }

        private void frm_SectionEdit_Load(object sender, EventArgs e)
        {
            txtSectionID.Text = SectionID;
            txtSectionName.Text = SectionName;
        }
    }
}